/**
 * Joint.h
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/06/11
 */

#pragma once

#include "Vec.h"
#include "IPersistence.h"

class CJoint : public IPersistence
{
public:
	CJoint();
	CJoint(double x1, double y1, double z1);
	virtual ~CJoint();

	enum JointType
	{
		eNone = -1,
		eFixed,
		eMoving
	};

// operator
	double				operator[](unsigned int i) const;
	void				operator=(const CJoint& obj);
	CVec				operator-(const CJoint& obj);
	CJoint				operator+(const CVec& obj);
	void				operator+=(const CVec& obj);

	virtual bool		OnRead(CXMLParser* pParser);
	virtual bool		OnWrite(CXMLParser* pParser);

	void				SetType(JointType type) { m_eType = type; }
	JointType			GetType() { return m_eType; }

private:
	double				x, y, z;
	JointType			m_eType;
};